package com.cqemme.comm.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 86156
 */

public enum EnumGrade {

    KINDERGARTEN(20,"幼儿园"),
    FIRST_GRADE(21,"一年级"),
    SECOND_GRADE(22,"二年级"),
    THIRD_GRADE(23,"三年级"),
    FOURTH_GRADE(24,"四年级"),
    FIFTH_GRADE(25,"五年级"),
    SIXTH_GRADE(26,"六年级"),
    SEVENTH_GRADE(27,"初一年级"),
    EIGHTH_GRADE(28,"初二年级"),
    NINTH_GRADE(29,"初三年级"),
    TENTH_GRADE(30,"高一年级"),
    ELEVENTH_GRADE(31,"高二年级"),
    TWELFTH_GRADE(32,"高三年级")
    ;

    private int index;
    private String text;

    public static String getText(int index) {
        EnumGrade[] p = values();
        for (int i = 0; i < p.length; ++i) {
            EnumGrade type = p[i];
            if (type.getIndex()==index){
                return type.getText();
            }
        }
        return null;
    }
    public static Integer getIndex(String text) {
        EnumGrade[] p = values();
        for (int i = 0; i < p.length; ++i) {
            EnumGrade type = p[i];
            if (type.getText().equals(text)){
                return type.getIndex();
            }
        }
        return null;
    }

    public static Map<Integer,String> getMap() {
        Map<Integer,String> map=new HashMap<Integer,String>();
        EnumGrade[] p = values();
        for (int i = 0; i < p.length; ++i) {
            EnumGrade type = p[i];
            map.put(type.getIndex(), type.getText());
        }
        return map;
    }


    private EnumGrade(int index, String text) {
        this.index = index;
        this.text = text;
    }

    public int getIndex() {
        return index;
    }

    public String getText() {
        return this.text;
    }

}
